; *** Chinese Checkers
; *** Copyright 1998-2002 Zillions Development
; v.2.0

; You need to purchase Zillions of Games to load this rules file
; Visit the Zillions web site at http://www.zillions-of-games.com

(version "2.0")

(define step ($1 (verify empty?) add))
(define jump (
     (verify (not last-from?))
     $1
     (verify not-empty?)
     $1
     (verify empty?)
     to
     (if last-from? back (verify (not last-to?))) ; Can't retrace step
     (add-partial jumptype)
))
(define longjump2 (
     (verify (not last-from?))
     $1 (verify empty?) $1
     (verify not-empty?)
     $1 (verify empty?) $1
     (verify empty?)
     to
     (if last-from? back (verify (not last-to?))) ; Can't retrace step
     (add-partial jumptype)
))
(define longjump3 (
     (verify (not last-from?))
     $1 (verify empty?) $1 (verify empty?) $1
     (verify not-empty?)
     $1 (verify empty?) $1 (verify empty?) $1
     (verify empty?)
     to
     (if last-from? back (verify (not last-to?))) ; Can't retrace step
     (add-partial jumptype)
))
(define longjump4 (
     (verify (not last-from?))
     $1 (verify empty?) $1 (verify empty?) $1 (verify empty?) $1
     (verify not-empty?)
     $1 (verify empty?) $1 (verify empty?) $1 (verify empty?) $1
     (verify empty?)
     to
     (if last-from? back (verify (not last-to?))) ; Can't retrace step
     (add-partial jumptype)
))
(define longjump5 (
     (verify (not last-from?))
     $1 (verify empty?) $1 (verify empty?) $1 (verify empty?) $1 (verify empty?) $1
     (verify not-empty?)
     $1 (verify empty?) $1 (verify empty?) $1 (verify empty?) $1 (verify empty?) $1
     (verify empty?)
     to
     (if last-from? back (verify (not last-to?))) ; Can't retrace step
     (add-partial jumptype)
))
(define longjump6 (
     (verify (not last-from?))
     $1 (verify empty?) $1 (verify empty?) $1 (verify empty?) $1 (verify empty?) $1 (verify empty?) $1
     (verify not-empty?)
     $1 (verify empty?) $1 (verify empty?) $1 (verify empty?) $1 (verify empty?) $1 (verify empty?) $1
     (verify empty?)
     to
     (if last-from? back (verify (not last-to?))) ; Can't retrace step
     (add-partial jumptype)
))
(define outjump ( ; jump from home zone over enemy piece
     (verify (in-zone? home))
     (verify (not last-from?))
     $1
     (verify enemy?)
     $1
     (verify empty?)
     to
     (if last-from? back (verify (not last-to?))) ; Can't retrace step
     (add-partial jumptype)
))
(define outjump2 ( ; jump from home zone over enemy piece
     (verify (in-zone? home))
     (verify (not last-from?))
     $1 (verify empty?) $1
     (verify enemy?)
     $1
     (verify empty?) $1 (verify empty?)
     to
     (if last-from? back (verify (not last-to?))) ; Can't retrace step
     (add-partial jumptype)
))
(define outjump3 ( ; jump from home zone over enemy piece
     (verify (in-zone? home))
     (verify (not last-from?))
     $1 (verify empty?) $1 (verify empty?) $1
     (verify enemy?)
     $1
     (verify empty?) $1 (verify empty?) $1 (verify empty?)
     to
     (if last-from? back (verify (not last-to?))) ; Can't retrace step
     (add-partial jumptype)
))
(define outjump4 ( ; jump from home zone over enemy piece
     (verify (in-zone? home))
     (verify (not last-from?))
     $1 (verify empty?) $1 (verify empty?) $1 (verify empty?) $1
     (verify enemy?)
     $1
     (verify empty?) $1 (verify empty?) $1 (verify empty?) $1 (verify empty?)
     to
     (if last-from? back (verify (not last-to?))) ; Can't retrace step
     (add-partial jumptype)
))   
(define outjump5 ( ; jump from home zone over enemy piece
     (verify (in-zone? home))
     (verify (not last-from?))
     $1 (verify empty?) $1 (verify empty?) $1 (verify empty?) $1 (verify empty?) $1
     (verify enemy?)
     $1
     (verify empty?) $1 (verify empty?) $1 (verify empty?) $1 (verify empty?) $1 (verify empty?)
     to
     (if last-from? back (verify (not last-to?))) ; Can't retrace step
     (add-partial jumptype)
))   
(define outjump6 ( ; jump from home zone over enemy piece
     (verify (in-zone? home))
     (verify (not last-from?))
     $1 (verify empty?) $1 (verify empty?) $1 (verify empty?) $1 (verify empty?) $1 (verify empty?) $1
     (verify enemy?)
     $1
     (verify empty?) $1 (verify empty?) $1 (verify empty?) $1 (verify empty?) $1 (verify empty?)
     to
     (if last-from? back (verify (not last-to?))) ; Can't retrace step
     (add-partial jumptype)
)) 
(define board-common
    (grid
        (start-rectangle $1 $2 $3 $4); top-left position
        (dimensions ;17x17
            ("a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q" ($7 0))
            ("1/2/3/4/5/6/7/8/9/10/11/12/13/14/15/16/17" ($5 $6))
		)
		(directions (nw 0 -1) (ne 1 -1) (e 1 0)
                    (se 0 1)  (sw -1 1) (w -1 0)
		)
	)
    (symmetry Purple (nw sw)(sw nw)(ne se)(se ne))
    (kill-positions
        a1  b1  c1  d1  e1  f1  g1  h1  i1  j1  k1  l1      n1  o1  p1  q1
        a2  b2  c2  d2  e2  f2  g2  h2  i2  j2  k2          n2  o2  p2  q2
        a3  b3  c3  d3  e3  f3  g3  h3  i3  j3              n3  o3  p3  q3
        a4  b4  c4  d4  e4  f4  g4  h4  i4                  n4  o4  p4  q4
        a5  b5  c5  d5
        a6  b6  c6  d6                                                  q6
        a7  b7  c7  d7                                              p7  q7
        a8  b8  c8  d8                                          o8  p8  q8
        a9  b9  c9  d9                                      n9  o9  p9  q9
        a10 b10 c10                                         n10 o10 p10 q10
        a11 b11                                             n11 o11 p11 q11
        a12                                                 n12 o12 p12 q12
                                                            n13 o13 p13 q13
        a14 b14 c14 d14                 i14 j14 k14 l14 m14 n14 o14 p14 q14
        a15 b15 c15 d15             h15 i15 j15 k15 l15 m15 n15 o15 p15 q15 
        a16 b16 c16 d16         g16 h16 i16 j16 k16 l16 m16 n16 o16 p16 q16
        a17 b17 c17 d17     f17 g17 h17 i17 j17 k17 l17 m17 n17 o17 p17 q17
    )
	(zone
         (name home)
         (players Green)
         (positions e17 f16 e16 e15 f15 g15 e14 f14 g14 h14 )
    )
	(zone
         (name home)
         (players Purple)
         (positions m1 l2 m2 k3 l3 m3 j4 k4 l4 m4 i5 j5 k5 l5 m5 e13 f13 g13 h13 i13)
    )
)

(variant
  (title "小型棋盘 - 3x3")
  (board
     (image "images/Chinese_Checkers/Mini3ChChkrBd.bmp")
     (grid
        (start-rectangle 101 7 129 32); top-left position
        (dimensions ;
            ("a/b/c" (-15 25))
            ("1/2/3" (15 25))
		)
		(directions (se 0 1) (w 1 -1) (sw 1 0)
                   (nw 0 -1)  (e -1 1) (ne -1 0))
	)
    (symmetry Purple (nw se)(sw ne)(ne sw)(se nw))
	(zone
         (name home)
         (players Green)
         (positions c3 c2 b3 )
    )
	(zone
         (name home)
         (players Purple)
         (positions a1 b1 a2)
    )
   )
   (board-setup
        (Green (marble
           c3 c2 b3
		))
		(Purple (marble
           a1 b1 a2
		))
	)
   (win-condition (Green)
        (absolute-config marble (
           a1 b1 a2
        ))
	)
	(win-condition (Purple)
		(absolute-config marble (
           c3 c2 b3
		))
    )
    (loss-condition (Green Purple) repetition)
)

(variant
  (title "中型棋盘 - 5x5")
  (board
     (image "images/Chinese_Checkers/Mini6ChChkrBd.bmp")
     (grid
        (start-rectangle 100 6 128 32); top-left position
        (dimensions ;
            ("a/b/c/d/e" (-15 25))
            ("1/2/3/4/5" (15 25))
		)
		(directions (se 0 1) (w 1 -1) (sw 1 0)
                   (nw 0 -1)  (e -1 1) (ne -1 0))
	)
    (symmetry Purple (nw se)(sw ne)(ne sw)(se nw))
		(zone
         (name home)
         (players Green)
         (positions e5 e4 e3 d5 d4 c5)
    )
	(zone
         (name home)
         (players Purple)
         (positions a1 b1 a2 c1 b2 a3)
    )
   )
   (board-setup
        (Green (marble e5 e4 e3 d5 d4 c5))
		(Purple (marble a1 b1 a2 c1 b2 a3))
	)
   (win-condition (Green)
        (absolute-config marble (a1 b1 a2 c1 b2 a3))
	)
	(win-condition (Purple)
		(absolute-config marble (e5 e4 e3 d5 d4 c5))
    )
    (loss-condition (Green Purple) repetition)
)

(variant
  (title "大型棋盘 - 7x7")
  (board
     (image "images/Chinese_Checkers/Mini10ChChkrBd.bmp")
     (grid
        (start-rectangle 100 6 128 32); top-left position
        (dimensions ;
            ("a/b/c/d/e/f/g" (-15 25))
            ("1/2/3/4/5/6/7" (15 25))
		)
		(directions (se 0 1) (w 1 -1) (sw 1 0)
                   (nw 0 -1)  (e -1 1) (ne -1 0))
	)
    (symmetry Purple (nw se)(sw ne)(ne sw)(se nw))
		(zone
         (name home)
         (players Green)
         (positions g7 f7 e7 d7 g6 f6 e6 g5 f5 g4 )
    )
	(zone
         (name home)
         (players Purple)
         (positions a1 b1 a2 c1 b2 a3 d1 c2 b3 a4)
    )
   )
   (board-setup
        (Green (marble
           g7 f7 e7 d7 g6 f6 e6 g5 f5 g4
		))
		(Purple (marble
                 a1 b1 a2 c1 b2 a3 d1 c2 b3 a4
		))
	)
   (win-condition (Green)
        (absolute-config marble (
                 a1 b1 a2 c1 b2 a3 d1 c2 b3 a4
        ))
	)
	(win-condition (Purple)
		(absolute-config marble (
           g7 f7 e7 d7 g6 f6 e6 g5 f5 g4
		))
    )
    (loss-condition (Green Purple) repetition)
)

(variant
   (title "-") ; --------------------------------------------------------
)

(game
    (title "标准跳棋")
	(description "跳棋\\双方轮流走子，可以沿线移动一格，或跳过相邻子至其后的相邻空格。可以连跳。\先把自己的子全部移到对方三角处为胜。如果想终止连跳，请点击工具栏的“跳过”按钮。\\这里有个附加规则：若你在本方三角内的棋子可以跳过对方棋子而离开本阵，则必须这么走，不得走其他棋子。")
	(history "Despite its name, Chinese Checkers appears to have no connection with
		China!  It was a variation on the 19th century game, Halma, and appeared on
		the market in the 1930's.")
	(strategy "It is much faster to make a series of leaps than it is to shift
		your marbles forward one square at a time.  Therefore it is the most
		efficient policy to set up long sequences of marbles that may be jumped
		over -- a bridge to the other side.  Be wary though that your opponent
		doesn't get more use out of these bridges than you do!")
    (option "pass partial" true)
 (default)
    (release-sound "Audio\\Ding.wav")
    (move-sound "Audio\\Ding.wav")

    (players Green Purple)
    (turn-order Green Purple)
	(move-priorities outmove)
    (board
        (image "images/Chinese_Checkers/Dragon1.bmp"
		"images/Chinese_Checkers/Dragon2.bmp"
		"images/Chinese_Checkers/ChChkrBd.bmp")
        (board-common -116 4 -97 21 10 17 20) ;(board-common -124 4 -104 21 10 17 21)
    )
    (piece
        (name marble)
		(help "Marble: steps the lines, can jump over pieces and keep jumping")
        (image Green "images/Chinese_Checkers/GreenMarble.bmp"
			   Purple "images/Chinese_Checkers/PurpleMarble.bmp")
		(description "A marble may move in one of two ways.  It may shift to an adjacent
			position or it may leap over an adjacent marble (of either color) to the
			opposite, unoccupied position.  A leaping marble may continue to leap
			over other marbles until there are no more marbles to leap over or the
			player decides to stop.  To stop leaping prematurely, select `Pass Move` from the
			menus or the toolbar.")
		(moves
			(move-type outmove)
			(outjump ne)
			(outjump nw)
			(move-type jumptype)
			(jump e)
			(jump w)
			(jump ne)
			(jump nw)
			(jump se)
			(jump sw)
			(move-type nonjumptype)
			(step e)
			(step w)
			(step ne)
			(step nw)
			(step se)
			(step sw)	
		)			
	)

    (board-setup
        (Green (marble
           e14 f14 g14 h14
             e15 f15 g15
               e16 f16
                 e17
		))
		(Purple (marble
                 m1
                l2 m2
              k3 l3 m3
            j4 k4 l4 m4
		))
	)

    (win-condition (Green)
        (absolute-config marble (
                 m1
                l2 m2
              k3 l3 m3
            j4 k4 l4 m4
        ))
	)
	(win-condition (Purple)
		(absolute-config marble (
           e14 f14 g14 h14
             e15 f15 g15
               e16 f16
                 e17
		))
    )
    (loss-condition (Green Purple) repetition)
)

(variant
    (title "标准跳棋-飞跳规则")
	(description "跳棋\\双方轮流走子，可以沿线移动一格，或跳过相邻子至其后的相邻空格。可以连跳。\先把自己的子全部移到对方三角处为胜。如果想终止连跳，请点击工具栏的“跳过”按钮。\\这里有个附加规则：若你在本方三角内的棋子可以跳过对方棋子而离开本阵，则必须这么走，不得走其他棋子。\\飞跳规则：你可以沿直线飞跳过一个棋子到与它对称的点上，只要目标点是空格即可。")
    (history "Despite its name, Chinese Checkers appears to have no connection with
		China!  It was a variation on the 19th century game, Halma, and appeared on
		the market in the 1930's.  Super Chinese Checkers is popular in France, and 
		is a faster version of the standard game.")
	(strategy "It is much faster to make a series of leaps than it is to shift
	    your marbles forward one square at a time.  Therefore it is the most
		efficient policy to set up long sequences of marbles that may be jumped
		over -- a bridge to the other side.  Be wary though that your opponent
		doesn't get more use out of these bridges than you do!  In Super Chinese
		Checkers, be careful of all those available long jumps!")

	(piece
        (name marble)
		(help "Marble: steps the lines, can jump over pieces and keep jumping")
        (image Green "images/Chinese_Checkers/GreenMarble.bmp"
			   Purple "images/Chinese_Checkers/PurpleMarble.bmp")
		(description "A marble may move in one of two ways.  It may shift to an adjacent
			position or it may leap over an adjacent marble (of either color) to the
			opposite, unoccupied position.  A leaping marble may continue to leap
			over other marbles until there are no more marbles to leap over or the
			player decides to stop.  To stop leaping prematurely, select `Pass Move` from the
			menus or the toolbar.  In Super Chinese Checkers, a piece can also make a long jump,
			jumping over 1 or more empty positions, as long as the only piece along this line is
			in the center of the line.")
		(moves
			(move-type outmove)
			(outjump ne)
			(outjump nw)
			(outjump2 ne)
			(outjump2 nw)
			(outjump3 ne)
			(outjump3 nw)
			(outjump4 ne)
			(outjump4 nw)
			(outjump5 ne)
			(outjump5 nw)
			(outjump6 ne)
			(outjump6 nw)
			(move-type jumptype)
			(jump e)
			(jump w)
			(jump ne)
			(jump nw)
			(jump se)
			(jump sw)
			(longjump2 e)
			(longjump2 w)
			(longjump2 ne)
			(longjump2 nw)
			(longjump2 se)
			(longjump2 sw)
			(longjump3 e)
			(longjump3 w)
			(longjump3 ne)
			(longjump3 nw)
			(longjump3 se)
			(longjump3 sw)
			(longjump4 e)
			(longjump4 w)
			(longjump4 ne)
			(longjump4 nw)
			(longjump4 se)
			(longjump4 sw)
			(longjump5 e)
			(longjump5 w)
			(longjump5 ne)
			(longjump5 nw)
			(longjump5 se)
			(longjump5 sw)
			(longjump6 e)
			(longjump6 w)
			(longjump6 ne)
			(longjump6 nw)
			(longjump6 se)
			(longjump6 sw)
			(move-type nonjumptype)
			(step e)
			(step w)
			(step ne)
			(step nw)
			(step se)
			(step sw)	
		)			
	)

)

